Left Termination of the query pattern goal_in_3(g, a, a) w.r.t. the given Prolog program could successfully be proven:



Prolog
  ↳ PrologToPiTRSProof

Clauses:

goal(A, B, C) :- ','(s2l(A, D), applast(D, B, C)).
applast(L, X, Last) :- ','(append(L, .(X, []), LX), last(Last, LX)).
last(X, .(X, [])).
last(X, .(H, T)) :- last(X, T).
append([], L, L).
append(.(H, L1), L2, .(H, L3)) :- append(L1, L2, L3).
s2l(s(X), .(Y, Xs)) :- s2l(X, Xs).
s2l(0, []).

Queries:

goal(g,a,a).

We use the technique of [30]. With regard to the inferred argument filtering the predicates were used in the following modes:
goal_in: (b,f,f)
s2l_in: (b,f)
applast_in: (b,f,f)
append_in: (b,b,f)
last_in: (f,b)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

goal_in_gaa(A, B, C) → U1_gaa(A, B, C, s2l_in_ga(A, D))
s2l_in_ga(s(X), .(Y, Xs)) → U7_ga(X, Y, Xs, s2l_in_ga(X, Xs))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
U7_ga(X, Y, Xs, s2l_out_ga(X, Xs)) → s2l_out_ga(s(X), .(Y, Xs))
U1_gaa(A, B, C, s2l_out_ga(A, D)) → U2_gaa(A, B, C, applast_in_gaa(D, B, C))
applast_in_gaa(L, X, Last) → U3_gaa(L, X, Last, append_in_gga(L, .(X, []), LX))
append_in_gga([], L, L) → append_out_gga([], L, L)
append_in_gga(.(H, L1), L2, .(H, L3)) → U6_gga(H, L1, L2, L3, append_in_gga(L1, L2, L3))
U6_gga(H, L1, L2, L3, append_out_gga(L1, L2, L3)) → append_out_gga(.(H, L1), L2, .(H, L3))
U3_gaa(L, X, Last, append_out_gga(L, .(X, []), LX)) → U4_gaa(L, X, Last, last_in_ag(Last, LX))
last_in_ag(X, .(X, [])) → last_out_ag(X, .(X, []))
last_in_ag(X, .(H, T)) → U5_ag(X, H, T, last_in_ag(X, T))
U5_ag(X, H, T, last_out_ag(X, T)) → last_out_ag(X, .(H, T))
U4_gaa(L, X, Last, last_out_ag(Last, LX)) → applast_out_gaa(L, X, Last)
U2_gaa(A, B, C, applast_out_gaa(D, B, C)) → goal_out_gaa(A, B, C)

The argument filtering Pi contains the following mapping:
goal_in_gaa(x1, x2, x3)  =  goal_in_gaa(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
s(x1)  =  s(x1)
U7_ga(x1, x2, x3, x4)  =  U7_ga(x4)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga(x2)
.(x1, x2)  =  .(x2)
U2_gaa(x1, x2, x3, x4)  =  U2_gaa(x4)
applast_in_gaa(x1, x2, x3)  =  applast_in_gaa(x1)
U3_gaa(x1, x2, x3, x4)  =  U3_gaa(x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
[]  =  []
append_out_gga(x1, x2, x3)  =  append_out_gga(x3)
U6_gga(x1, x2, x3, x4, x5)  =  U6_gga(x5)
U4_gaa(x1, x2, x3, x4)  =  U4_gaa(x4)
last_in_ag(x1, x2)  =  last_in_ag(x2)
last_out_ag(x1, x2)  =  last_out_ag
U5_ag(x1, x2, x3, x4)  =  U5_ag(x4)
applast_out_gaa(x1, x2, x3)  =  applast_out_gaa
goal_out_gaa(x1, x2, x3)  =  goal_out_gaa

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

goal_in_gaa(A, B, C) → U1_gaa(A, B, C, s2l_in_ga(A, D))
s2l_in_ga(s(X), .(Y, Xs)) → U7_ga(X, Y, Xs, s2l_in_ga(X, Xs))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
U7_ga(X, Y, Xs, s2l_out_ga(X, Xs)) → s2l_out_ga(s(X), .(Y, Xs))
U1_gaa(A, B, C, s2l_out_ga(A, D)) → U2_gaa(A, B, C, applast_in_gaa(D, B, C))
applast_in_gaa(L, X, Last) → U3_gaa(L, X, Last, append_in_gga(L, .(X, []), LX))
append_in_gga([], L, L) → append_out_gga([], L, L)
append_in_gga(.(H, L1), L2, .(H, L3)) → U6_gga(H, L1, L2, L3, append_in_gga(L1, L2, L3))
U6_gga(H, L1, L2, L3, append_out_gga(L1, L2, L3)) → append_out_gga(.(H, L1), L2, .(H, L3))
U3_gaa(L, X, Last, append_out_gga(L, .(X, []), LX)) → U4_gaa(L, X, Last, last_in_ag(Last, LX))
last_in_ag(X, .(X, [])) → last_out_ag(X, .(X, []))
last_in_ag(X, .(H, T)) → U5_ag(X, H, T, last_in_ag(X, T))
U5_ag(X, H, T, last_out_ag(X, T)) → last_out_ag(X, .(H, T))
U4_gaa(L, X, Last, last_out_ag(Last, LX)) → applast_out_gaa(L, X, Last)
U2_gaa(A, B, C, applast_out_gaa(D, B, C)) → goal_out_gaa(A, B, C)

The argument filtering Pi contains the following mapping:
goal_in_gaa(x1, x2, x3)  =  goal_in_gaa(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
s(x1)  =  s(x1)
U7_ga(x1, x2, x3, x4)  =  U7_ga(x4)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga(x2)
.(x1, x2)  =  .(x2)
U2_gaa(x1, x2, x3, x4)  =  U2_gaa(x4)
applast_in_gaa(x1, x2, x3)  =  applast_in_gaa(x1)
U3_gaa(x1, x2, x3, x4)  =  U3_gaa(x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
[]  =  []
append_out_gga(x1, x2, x3)  =  append_out_gga(x3)
U6_gga(x1, x2, x3, x4, x5)  =  U6_gga(x5)
U4_gaa(x1, x2, x3, x4)  =  U4_gaa(x4)
last_in_ag(x1, x2)  =  last_in_ag(x2)
last_out_ag(x1, x2)  =  last_out_ag
U5_ag(x1, x2, x3, x4)  =  U5_ag(x4)
applast_out_gaa(x1, x2, x3)  =  applast_out_gaa
goal_out_gaa(x1, x2, x3)  =  goal_out_gaa


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

GOAL_IN_GAA(A, B, C) → U1_GAA(A, B, C, s2l_in_ga(A, D))
GOAL_IN_GAA(A, B, C) → S2L_IN_GA(A, D)
S2L_IN_GA(s(X), .(Y, Xs)) → U7_GA(X, Y, Xs, s2l_in_ga(X, Xs))
S2L_IN_GA(s(X), .(Y, Xs)) → S2L_IN_GA(X, Xs)
U1_GAA(A, B, C, s2l_out_ga(A, D)) → U2_GAA(A, B, C, applast_in_gaa(D, B, C))
U1_GAA(A, B, C, s2l_out_ga(A, D)) → APPLAST_IN_GAA(D, B, C)
APPLAST_IN_GAA(L, X, Last) → U3_GAA(L, X, Last, append_in_gga(L, .(X, []), LX))
APPLAST_IN_GAA(L, X, Last) → APPEND_IN_GGA(L, .(X, []), LX)
APPEND_IN_GGA(.(H, L1), L2, .(H, L3)) → U6_GGA(H, L1, L2, L3, append_in_gga(L1, L2, L3))
APPEND_IN_GGA(.(H, L1), L2, .(H, L3)) → APPEND_IN_GGA(L1, L2, L3)
U3_GAA(L, X, Last, append_out_gga(L, .(X, []), LX)) → U4_GAA(L, X, Last, last_in_ag(Last, LX))
U3_GAA(L, X, Last, append_out_gga(L, .(X, []), LX)) → LAST_IN_AG(Last, LX)
LAST_IN_AG(X, .(H, T)) → U5_AG(X, H, T, last_in_ag(X, T))
LAST_IN_AG(X, .(H, T)) → LAST_IN_AG(X, T)

The TRS R consists of the following rules:

goal_in_gaa(A, B, C) → U1_gaa(A, B, C, s2l_in_ga(A, D))
s2l_in_ga(s(X), .(Y, Xs)) → U7_ga(X, Y, Xs, s2l_in_ga(X, Xs))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
U7_ga(X, Y, Xs, s2l_out_ga(X, Xs)) → s2l_out_ga(s(X), .(Y, Xs))
U1_gaa(A, B, C, s2l_out_ga(A, D)) → U2_gaa(A, B, C, applast_in_gaa(D, B, C))
applast_in_gaa(L, X, Last) → U3_gaa(L, X, Last, append_in_gga(L, .(X, []), LX))
append_in_gga([], L, L) → append_out_gga([], L, L)
append_in_gga(.(H, L1), L2, .(H, L3)) → U6_gga(H, L1, L2, L3, append_in_gga(L1, L2, L3))
U6_gga(H, L1, L2, L3, append_out_gga(L1, L2, L3)) → append_out_gga(.(H, L1), L2, .(H, L3))
U3_gaa(L, X, Last, append_out_gga(L, .(X, []), LX)) → U4_gaa(L, X, Last, last_in_ag(Last, LX))
last_in_ag(X, .(X, [])) → last_out_ag(X, .(X, []))
last_in_ag(X, .(H, T)) → U5_ag(X, H, T, last_in_ag(X, T))
U5_ag(X, H, T, last_out_ag(X, T)) → last_out_ag(X, .(H, T))
U4_gaa(L, X, Last, last_out_ag(Last, LX)) → applast_out_gaa(L, X, Last)
U2_gaa(A, B, C, applast_out_gaa(D, B, C)) → goal_out_gaa(A, B, C)

The argument filtering Pi contains the following mapping:
goal_in_gaa(x1, x2, x3)  =  goal_in_gaa(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
s(x1)  =  s(x1)
U7_ga(x1, x2, x3, x4)  =  U7_ga(x4)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga(x2)
.(x1, x2)  =  .(x2)
U2_gaa(x1, x2, x3, x4)  =  U2_gaa(x4)
applast_in_gaa(x1, x2, x3)  =  applast_in_gaa(x1)
U3_gaa(x1, x2, x3, x4)  =  U3_gaa(x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
[]  =  []
append_out_gga(x1, x2, x3)  =  append_out_gga(x3)
U6_gga(x1, x2, x3, x4, x5)  =  U6_gga(x5)
U4_gaa(x1, x2, x3, x4)  =  U4_gaa(x4)
last_in_ag(x1, x2)  =  last_in_ag(x2)
last_out_ag(x1, x2)  =  last_out_ag
U5_ag(x1, x2, x3, x4)  =  U5_ag(x4)
applast_out_gaa(x1, x2, x3)  =  applast_out_gaa
goal_out_gaa(x1, x2, x3)  =  goal_out_gaa
U6_GGA(x1, x2, x3, x4, x5)  =  U6_GGA(x5)
APPEND_IN_GGA(x1, x2, x3)  =  APPEND_IN_GGA(x1, x2)
U3_GAA(x1, x2, x3, x4)  =  U3_GAA(x4)
S2L_IN_GA(x1, x2)  =  S2L_IN_GA(x1)
LAST_IN_AG(x1, x2)  =  LAST_IN_AG(x2)
U4_GAA(x1, x2, x3, x4)  =  U4_GAA(x4)
U2_GAA(x1, x2, x3, x4)  =  U2_GAA(x4)
U1_GAA(x1, x2, x3, x4)  =  U1_GAA(x4)
GOAL_IN_GAA(x1, x2, x3)  =  GOAL_IN_GAA(x1)
U5_AG(x1, x2, x3, x4)  =  U5_AG(x4)
U7_GA(x1, x2, x3, x4)  =  U7_GA(x4)
APPLAST_IN_GAA(x1, x2, x3)  =  APPLAST_IN_GAA(x1)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

Pi DP problem:
The TRS P consists of the following rules:

GOAL_IN_GAA(A, B, C) → U1_GAA(A, B, C, s2l_in_ga(A, D))
GOAL_IN_GAA(A, B, C) → S2L_IN_GA(A, D)
S2L_IN_GA(s(X), .(Y, Xs)) → U7_GA(X, Y, Xs, s2l_in_ga(X, Xs))
S2L_IN_GA(s(X), .(Y, Xs)) → S2L_IN_GA(X, Xs)
U1_GAA(A, B, C, s2l_out_ga(A, D)) → U2_GAA(A, B, C, applast_in_gaa(D, B, C))
U1_GAA(A, B, C, s2l_out_ga(A, D)) → APPLAST_IN_GAA(D, B, C)
APPLAST_IN_GAA(L, X, Last) → U3_GAA(L, X, Last, append_in_gga(L, .(X, []), LX))
APPLAST_IN_GAA(L, X, Last) → APPEND_IN_GGA(L, .(X, []), LX)
APPEND_IN_GGA(.(H, L1), L2, .(H, L3)) → U6_GGA(H, L1, L2, L3, append_in_gga(L1, L2, L3))
APPEND_IN_GGA(.(H, L1), L2, .(H, L3)) → APPEND_IN_GGA(L1, L2, L3)
U3_GAA(L, X, Last, append_out_gga(L, .(X, []), LX)) → U4_GAA(L, X, Last, last_in_ag(Last, LX))
U3_GAA(L, X, Last, append_out_gga(L, .(X, []), LX)) → LAST_IN_AG(Last, LX)
LAST_IN_AG(X, .(H, T)) → U5_AG(X, H, T, last_in_ag(X, T))
LAST_IN_AG(X, .(H, T)) → LAST_IN_AG(X, T)

The TRS R consists of the following rules:

goal_in_gaa(A, B, C) → U1_gaa(A, B, C, s2l_in_ga(A, D))
s2l_in_ga(s(X), .(Y, Xs)) → U7_ga(X, Y, Xs, s2l_in_ga(X, Xs))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
U7_ga(X, Y, Xs, s2l_out_ga(X, Xs)) → s2l_out_ga(s(X), .(Y, Xs))
U1_gaa(A, B, C, s2l_out_ga(A, D)) → U2_gaa(A, B, C, applast_in_gaa(D, B, C))
applast_in_gaa(L, X, Last) → U3_gaa(L, X, Last, append_in_gga(L, .(X, []), LX))
append_in_gga([], L, L) → append_out_gga([], L, L)
append_in_gga(.(H, L1), L2, .(H, L3)) → U6_gga(H, L1, L2, L3, append_in_gga(L1, L2, L3))
U6_gga(H, L1, L2, L3, append_out_gga(L1, L2, L3)) → append_out_gga(.(H, L1), L2, .(H, L3))
U3_gaa(L, X, Last, append_out_gga(L, .(X, []), LX)) → U4_gaa(L, X, Last, last_in_ag(Last, LX))
last_in_ag(X, .(X, [])) → last_out_ag(X, .(X, []))
last_in_ag(X, .(H, T)) → U5_ag(X, H, T, last_in_ag(X, T))
U5_ag(X, H, T, last_out_ag(X, T)) → last_out_ag(X, .(H, T))
U4_gaa(L, X, Last, last_out_ag(Last, LX)) → applast_out_gaa(L, X, Last)
U2_gaa(A, B, C, applast_out_gaa(D, B, C)) → goal_out_gaa(A, B, C)

The argument filtering Pi contains the following mapping:
goal_in_gaa(x1, x2, x3)  =  goal_in_gaa(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
s(x1)  =  s(x1)
U7_ga(x1, x2, x3, x4)  =  U7_ga(x4)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga(x2)
.(x1, x2)  =  .(x2)
U2_gaa(x1, x2, x3, x4)  =  U2_gaa(x4)
applast_in_gaa(x1, x2, x3)  =  applast_in_gaa(x1)
U3_gaa(x1, x2, x3, x4)  =  U3_gaa(x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
[]  =  []
append_out_gga(x1, x2, x3)  =  append_out_gga(x3)
U6_gga(x1, x2, x3, x4, x5)  =  U6_gga(x5)
U4_gaa(x1, x2, x3, x4)  =  U4_gaa(x4)
last_in_ag(x1, x2)  =  last_in_ag(x2)
last_out_ag(x1, x2)  =  last_out_ag
U5_ag(x1, x2, x3, x4)  =  U5_ag(x4)
applast_out_gaa(x1, x2, x3)  =  applast_out_gaa
goal_out_gaa(x1, x2, x3)  =  goal_out_gaa
U6_GGA(x1, x2, x3, x4, x5)  =  U6_GGA(x5)
APPEND_IN_GGA(x1, x2, x3)  =  APPEND_IN_GGA(x1, x2)
U3_GAA(x1, x2, x3, x4)  =  U3_GAA(x4)
S2L_IN_GA(x1, x2)  =  S2L_IN_GA(x1)
LAST_IN_AG(x1, x2)  =  LAST_IN_AG(x2)
U4_GAA(x1, x2, x3, x4)  =  U4_GAA(x4)
U2_GAA(x1, x2, x3, x4)  =  U2_GAA(x4)
U1_GAA(x1, x2, x3, x4)  =  U1_GAA(x4)
GOAL_IN_GAA(x1, x2, x3)  =  GOAL_IN_GAA(x1)
U5_AG(x1, x2, x3, x4)  =  U5_AG(x4)
U7_GA(x1, x2, x3, x4)  =  U7_GA(x4)
APPLAST_IN_GAA(x1, x2, x3)  =  APPLAST_IN_GAA(x1)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 3 SCCs with 11 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

LAST_IN_AG(X, .(H, T)) → LAST_IN_AG(X, T)

The TRS R consists of the following rules:

goal_in_gaa(A, B, C) → U1_gaa(A, B, C, s2l_in_ga(A, D))
s2l_in_ga(s(X), .(Y, Xs)) → U7_ga(X, Y, Xs, s2l_in_ga(X, Xs))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
U7_ga(X, Y, Xs, s2l_out_ga(X, Xs)) → s2l_out_ga(s(X), .(Y, Xs))
U1_gaa(A, B, C, s2l_out_ga(A, D)) → U2_gaa(A, B, C, applast_in_gaa(D, B, C))
applast_in_gaa(L, X, Last) → U3_gaa(L, X, Last, append_in_gga(L, .(X, []), LX))
append_in_gga([], L, L) → append_out_gga([], L, L)
append_in_gga(.(H, L1), L2, .(H, L3)) → U6_gga(H, L1, L2, L3, append_in_gga(L1, L2, L3))
U6_gga(H, L1, L2, L3, append_out_gga(L1, L2, L3)) → append_out_gga(.(H, L1), L2, .(H, L3))
U3_gaa(L, X, Last, append_out_gga(L, .(X, []), LX)) → U4_gaa(L, X, Last, last_in_ag(Last, LX))
last_in_ag(X, .(X, [])) → last_out_ag(X, .(X, []))
last_in_ag(X, .(H, T)) → U5_ag(X, H, T, last_in_ag(X, T))
U5_ag(X, H, T, last_out_ag(X, T)) → last_out_ag(X, .(H, T))
U4_gaa(L, X, Last, last_out_ag(Last, LX)) → applast_out_gaa(L, X, Last)
U2_gaa(A, B, C, applast_out_gaa(D, B, C)) → goal_out_gaa(A, B, C)

The argument filtering Pi contains the following mapping:
goal_in_gaa(x1, x2, x3)  =  goal_in_gaa(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
s(x1)  =  s(x1)
U7_ga(x1, x2, x3, x4)  =  U7_ga(x4)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga(x2)
.(x1, x2)  =  .(x2)
U2_gaa(x1, x2, x3, x4)  =  U2_gaa(x4)
applast_in_gaa(x1, x2, x3)  =  applast_in_gaa(x1)
U3_gaa(x1, x2, x3, x4)  =  U3_gaa(x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
[]  =  []
append_out_gga(x1, x2, x3)  =  append_out_gga(x3)
U6_gga(x1, x2, x3, x4, x5)  =  U6_gga(x5)
U4_gaa(x1, x2, x3, x4)  =  U4_gaa(x4)
last_in_ag(x1, x2)  =  last_in_ag(x2)
last_out_ag(x1, x2)  =  last_out_ag
U5_ag(x1, x2, x3, x4)  =  U5_ag(x4)
applast_out_gaa(x1, x2, x3)  =  applast_out_gaa
goal_out_gaa(x1, x2, x3)  =  goal_out_gaa
LAST_IN_AG(x1, x2)  =  LAST_IN_AG(x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

LAST_IN_AG(X, .(H, T)) → LAST_IN_AG(X, T)

R is empty.
The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x2)
LAST_IN_AG(x1, x2)  =  LAST_IN_AG(x2)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

LAST_IN_AG(.(T)) → LAST_IN_AG(T)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

APPEND_IN_GGA(.(H, L1), L2, .(H, L3)) → APPEND_IN_GGA(L1, L2, L3)

The TRS R consists of the following rules:

goal_in_gaa(A, B, C) → U1_gaa(A, B, C, s2l_in_ga(A, D))
s2l_in_ga(s(X), .(Y, Xs)) → U7_ga(X, Y, Xs, s2l_in_ga(X, Xs))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
U7_ga(X, Y, Xs, s2l_out_ga(X, Xs)) → s2l_out_ga(s(X), .(Y, Xs))
U1_gaa(A, B, C, s2l_out_ga(A, D)) → U2_gaa(A, B, C, applast_in_gaa(D, B, C))
applast_in_gaa(L, X, Last) → U3_gaa(L, X, Last, append_in_gga(L, .(X, []), LX))
append_in_gga([], L, L) → append_out_gga([], L, L)
append_in_gga(.(H, L1), L2, .(H, L3)) → U6_gga(H, L1, L2, L3, append_in_gga(L1, L2, L3))
U6_gga(H, L1, L2, L3, append_out_gga(L1, L2, L3)) → append_out_gga(.(H, L1), L2, .(H, L3))
U3_gaa(L, X, Last, append_out_gga(L, .(X, []), LX)) → U4_gaa(L, X, Last, last_in_ag(Last, LX))
last_in_ag(X, .(X, [])) → last_out_ag(X, .(X, []))
last_in_ag(X, .(H, T)) → U5_ag(X, H, T, last_in_ag(X, T))
U5_ag(X, H, T, last_out_ag(X, T)) → last_out_ag(X, .(H, T))
U4_gaa(L, X, Last, last_out_ag(Last, LX)) → applast_out_gaa(L, X, Last)
U2_gaa(A, B, C, applast_out_gaa(D, B, C)) → goal_out_gaa(A, B, C)

The argument filtering Pi contains the following mapping:
goal_in_gaa(x1, x2, x3)  =  goal_in_gaa(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
s(x1)  =  s(x1)
U7_ga(x1, x2, x3, x4)  =  U7_ga(x4)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga(x2)
.(x1, x2)  =  .(x2)
U2_gaa(x1, x2, x3, x4)  =  U2_gaa(x4)
applast_in_gaa(x1, x2, x3)  =  applast_in_gaa(x1)
U3_gaa(x1, x2, x3, x4)  =  U3_gaa(x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
[]  =  []
append_out_gga(x1, x2, x3)  =  append_out_gga(x3)
U6_gga(x1, x2, x3, x4, x5)  =  U6_gga(x5)
U4_gaa(x1, x2, x3, x4)  =  U4_gaa(x4)
last_in_ag(x1, x2)  =  last_in_ag(x2)
last_out_ag(x1, x2)  =  last_out_ag
U5_ag(x1, x2, x3, x4)  =  U5_ag(x4)
applast_out_gaa(x1, x2, x3)  =  applast_out_gaa
goal_out_gaa(x1, x2, x3)  =  goal_out_gaa
APPEND_IN_GGA(x1, x2, x3)  =  APPEND_IN_GGA(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

APPEND_IN_GGA(.(H, L1), L2, .(H, L3)) → APPEND_IN_GGA(L1, L2, L3)

R is empty.
The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x2)
APPEND_IN_GGA(x1, x2, x3)  =  APPEND_IN_GGA(x1, x2)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

APPEND_IN_GGA(.(L1), L2) → APPEND_IN_GGA(L1, L2)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof

Pi DP problem:
The TRS P consists of the following rules:

S2L_IN_GA(s(X), .(Y, Xs)) → S2L_IN_GA(X, Xs)

The TRS R consists of the following rules:

goal_in_gaa(A, B, C) → U1_gaa(A, B, C, s2l_in_ga(A, D))
s2l_in_ga(s(X), .(Y, Xs)) → U7_ga(X, Y, Xs, s2l_in_ga(X, Xs))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
U7_ga(X, Y, Xs, s2l_out_ga(X, Xs)) → s2l_out_ga(s(X), .(Y, Xs))
U1_gaa(A, B, C, s2l_out_ga(A, D)) → U2_gaa(A, B, C, applast_in_gaa(D, B, C))
applast_in_gaa(L, X, Last) → U3_gaa(L, X, Last, append_in_gga(L, .(X, []), LX))
append_in_gga([], L, L) → append_out_gga([], L, L)
append_in_gga(.(H, L1), L2, .(H, L3)) → U6_gga(H, L1, L2, L3, append_in_gga(L1, L2, L3))
U6_gga(H, L1, L2, L3, append_out_gga(L1, L2, L3)) → append_out_gga(.(H, L1), L2, .(H, L3))
U3_gaa(L, X, Last, append_out_gga(L, .(X, []), LX)) → U4_gaa(L, X, Last, last_in_ag(Last, LX))
last_in_ag(X, .(X, [])) → last_out_ag(X, .(X, []))
last_in_ag(X, .(H, T)) → U5_ag(X, H, T, last_in_ag(X, T))
U5_ag(X, H, T, last_out_ag(X, T)) → last_out_ag(X, .(H, T))
U4_gaa(L, X, Last, last_out_ag(Last, LX)) → applast_out_gaa(L, X, Last)
U2_gaa(A, B, C, applast_out_gaa(D, B, C)) → goal_out_gaa(A, B, C)

The argument filtering Pi contains the following mapping:
goal_in_gaa(x1, x2, x3)  =  goal_in_gaa(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
s(x1)  =  s(x1)
U7_ga(x1, x2, x3, x4)  =  U7_ga(x4)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga(x2)
.(x1, x2)  =  .(x2)
U2_gaa(x1, x2, x3, x4)  =  U2_gaa(x4)
applast_in_gaa(x1, x2, x3)  =  applast_in_gaa(x1)
U3_gaa(x1, x2, x3, x4)  =  U3_gaa(x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
[]  =  []
append_out_gga(x1, x2, x3)  =  append_out_gga(x3)
U6_gga(x1, x2, x3, x4, x5)  =  U6_gga(x5)
U4_gaa(x1, x2, x3, x4)  =  U4_gaa(x4)
last_in_ag(x1, x2)  =  last_in_ag(x2)
last_out_ag(x1, x2)  =  last_out_ag
U5_ag(x1, x2, x3, x4)  =  U5_ag(x4)
applast_out_gaa(x1, x2, x3)  =  applast_out_gaa
goal_out_gaa(x1, x2, x3)  =  goal_out_gaa
S2L_IN_GA(x1, x2)  =  S2L_IN_GA(x1)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof

Pi DP problem:
The TRS P consists of the following rules:

S2L_IN_GA(s(X), .(Y, Xs)) → S2L_IN_GA(X, Xs)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
.(x1, x2)  =  .(x2)
S2L_IN_GA(x1, x2)  =  S2L_IN_GA(x1)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof

Q DP problem:
The TRS P consists of the following rules:

S2L_IN_GA(s(X)) → S2L_IN_GA(X)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs: